The `sort` template func was producing a `[]page.Page` which did not work in `.Paginate`. Fixes #6023
* Rewind paginator for server mode * Add some more related tests. * Replace the clumsy scratch constructs in internal paginator template with variables See #5825