Avoid perf issues in Mysql with large offsets in queries

Suggested-By: @AD7six
Improves 2d9538eb771b4c622de2c2b42df5320b39e4123c