Use LIMIT $limit OFFSET $offset for compatibility

This form is supported by mysql, sqlite and postgresql.
The previous one, LIMIT $offset,$limit is not supported by postgresql