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