20150203 - Title changed from 'JModelLegacy returns 0 items when setting limit 0 and limitstart > 0' because title did not fit anymore.
I am developing a component and after debugging a while I found a very strange phenomenon.
In my frontend you can set a pagination limit to see a defined limit of items. Everything looks fine at the first sight.
Under several circumstances I got back zero items. Thats why I started debugging the code.
In the Legacy Model of Joomla
\libraries\legacy\model\legacy.php there is a function
_getList($query, $limitstart = 0, $limit = 0), which is responsible for initiating the query and returning the results. And here is my problem:
If $limitstart has a value > 0 and $limit = 0, then no items will be returned. This problem arises when you switch with the pagination to the last site. The limit will be set to 0, because there is no limit any more. Only the last results should be shown, eg. $startlimit = 15 and $total = 18, but the mentioned function returns 0.
What's wrong here? Can anybody help?