Added server side sorting and server side pagination.

This commit includes bespoke count SQL queries.  Simple queries will be
added soon.