Fix pagination with distance query