Updating PaginationView object and template so that it generates page controls automatically
Minor logic fix in the loop for generating page controls