Issue 892 pagination

Fixes #892
Also adds some missing tests for some cache functions, as well as changing the interface of cache.applications module to have n_draft and n_featured as private functions, so they will be accessed using n_count with 'draft' and 'featured' as the categories specified.