More fixes to pagination, including a proper calculation of total pages and fixes to the datalist to ensure the paginator is always refreshed when the list changes.