Added the paginate method, and called it for the main pages and for each category.