Csqldataprovider Always Returns Last Page

I have a CSqlDataProvider, which runs a query and uses the standard pagination.

When I reach the last page, I get the expected behavior. But when I try next pages, I always get the last one (I want to get an empty set instead). How can I go about this? Was this intended by design?

$competitors = new CSqlDataProvider($sql, array(

      'params' => $params,

      'totalItemCount' => $count,

      'pagination' => array(

          'pageSize' => $limit,


      'sort' => array(

          'defaultOrder' => 'selected DESC, store_name',




i have same porblem

and i useed this code


    return false;


This is intended.

$dataProviderObject->getPagination()->getPageCount() will get you the total number of pages.