CONTRIB-4091 Fix for pagination when groups or groupings used.
Merge pull request #21 from jamiepratt/wip_CONTRIB-4091

CONTRIB-4091 Fix for pagination when groups or groupings used.