Moved the pagination logic on the record view to the server side. Simplifies the templates and allows future optimisation.