[DDC-2381] Wrong pagination query. Problems at large data.