Add pagination to the template