Fix pagination from log grouping queries