pagination template refactoring
in progress