calculate pages in case for total being 0. (ignore it only when total is null).
save values as part of the pager's info (which is probably used to construct query).