Fix pagination for queries with offset.

Apply the offset only to the first page, to avoid losing results in the following pages.