Cpagination Offset Not Working As Expcected

Hey everyone, I just wanted to post this in here because it was something I was having trouble with and eventually found out the answer to, but never found any other posts concerning it.

I have page with a jQuery infinite scroll (http://www.draftsharks.com/sharkbites/) working, and for some reason I noticed that results started repeating. This was an obvious issue for pages where there was only one result, and it continuously loaded the same one onto the page. I did some debugging and realized that the offset wasn’t being set correctly according to the page variable being passed in.

So, I looked at the applylimit() function which set had setOffset() which used getCurrentPage() (http://www.yiiframework.com/doc/api/1.1/CPagination#getCurrentPage-detail). In that function, if the current page is greater than the total number of pages it will reset it back to the last page. So, using the pagination method in querying the models prevented me from ever going to the last page where there would be no results, which is why I was repeatedly reloading the same last results.

Not really a bug, as I’m assuming that it’s designed this way to be used in conjunction with a CLinkPager and such. I just wanted to bring this up, because I was definitely expecting it to return no results once we were past the last page, but the designed behavior is to not let it go past the last page.

Hope this helps someone if they run into the same problem :)