[Bug 8457] back-sql: unordered entries combined with pagination gives wrong results