move html from paginate functions to template