Pagination bug fixed

Check if there are a number of pages to paginate over of not.