Moved pagination to a template part to cut down on code duplication