Pagination script for history pages.