pagination with template