Paginator - Fixes in the query builder adapter

Contains fixes from the #3040 PR and fix #2065 for 2.0.0