pagination for range queries