Add pagination to task index.
Fix offset < 0 error in pagination.
Move offset logic to controller for task index view.