Fixed a pagination issue with getStart computation, for custom limit/limit start.
$start value should only be adjusted if it's superior to $total, and not $total - $limit
In the case of a custom pagination (for example for a webservice api), it's possible that you won't be pulling pages using a constant $limit, so you might end up with something like:
$start = 140;
$limit = 15;
$total = 150;
In that case, the query should just return the items 140 to 150, but as 140 > 150 -15, it's recalculated to 135, so it will return items 135-150 instead
Sorry that it has taken so long to respond to this pull request. The code looks right but it needs some testing. Can you rebase your branch to the 4.2 branch and add some API system tests? You mentioned this change will very likely affect webservices so we need to make sure that it will not introduce a BC break here. In the meantime I will close it. When ready, please reopen this pull request again.
RTC after two successful tests.