Fix regression in f1dc4b3d; total_count is not the same as total_pages

Fixes #958. This is the expedient thing to revert, but maybe there's a better approach. @jcoyne?