You can clone with
HTTPS or Subversion.
This looks wrong:
// increase limit by offset when visitor paginates
$limit += (int)$offset;
Since it doesn't look like the $offset is set in the current code, this probably won't be a compat buster: remove the += statement, and change the LIMIT clause to:
LIMIT ".(int)$limit." OFFSET ".(int)$offset;
which is compatible with PostgreSQL syntax.
(In ) fixes #1850