Who will help with pagination in Yii?

Hello, there is a problem with the widget ListView and pagination. The point is, what is the output of goods on the website and for some reason the number of pagination pages are formed correctly, but that is exactly 50% of the extra pages that are blank. Maybe someone faced with similar, please help.

View
$this->widget('bootstrap.widgets.BsListView', array(
'dataProvider'=>$model->search(),
 'ajaxUpdate' => true,
'itemView'=>'application.views.shopProducts._view',
 'enablePagination' => true,
'id'=>$name,
 'itemsCssClass'=>'items table table-striped table-condensed',
 'emptyText'=>'<i> No products.</i>',
 'template' => '<div class="row">{items}</div>{pager}'


Controller
public function actionSearch() {

 $model = new ShopProducts('search');
 $model->unsetAttributes(); // clear any default values
 $model->main_category = ShopCategory::model()->findByAttributes(array('alias'=>$_GET['alias']));
 $model->main_category = $model->main_category->id;
 if(!isset($_GET['brand']) && is_array($_GET['brand']))
 $cats = ShopCategory::getAllSubCategories($model->main_category);


 if (isset($_GET['ShopProducts']))
 $model->attributes = $_GET['ShopProducts'];

 if(!isset($_GET['brand']) && is_array($_GET['brand']))$model->withInCategory($cats);
$model->withPrice()->withMainPhoto();


 if(isset($_GET['brand']) && is_array($_GET['brand'])){

 $shopCat = array();


 foreach ($_GET['brand'] as $item) {

 $v = ShopCategory::getAllSubCategories($item);

 foreach($v as $k){
 $shopCats[] = $k;
}
 $allCats = array_merge($shopCat, $shopCats);
$model->withInCategory($allCats);
}


}

 if(isset($_GET['liquid']) && is_array($_GET['liquid'])){

 $model->liquid = implode(', ', $_GET['liquid']);

}

 if(isset($_GET['plant']) && is_array($_GET['plant'])){

 $model->plant = implode(', ', $_GET['plant']);

}

 if(isset($_GET['capacity_from']) || isset($_GET['capacity_to'])){

 $model->capacity_from = $_GET['capacity_from'];
 $model->capacity_to = $_GET['capacity_to'];

}

 if(isset($_GET['pressure_from']) || isset($_GET['pressure_to'])){

 $model->pressure_from = $_GET['pressure_from'];
 $model->pressure_to = $_GET['pressure_to'];

}

 if(isset($_GET['voltage']) && is_array($_GET['voltage'])){

 $model->voltage = implode(', ', $_GET['voltage']);

}

/*Pots*/

 if(isset($_GET['plant_bak']) && is_array($_GET['plant_bak'])){

 $model->plant_bak = implode(', ', $_GET['plant_bak']);

}

 if(isset($_GET['volume_from']) || isset($_GET['volume_to'])){

 $model->volume_from = $_GET['volume_from'];
 $model->volume_to = $_GET['volume_to'];

}

 /*Pump station*/

 if(isset($_GET['deep_from']) || isset($_GET['deep_to'])){

 $model->deep_from = $_GET['deep_from'];
 $model->deep_to = $_GET['deep_to'];

}

/*Automation*/

 if(isset($_GET['tok_from']) || isset($_GET['tok_to'])){

 $model->tok_from = $_GET['tok_from'];
 $model->tok_to = $_GET['tok_to'];

}

 if(isset($_GET['type']) && is_array($_GET['type'])){

 $model->type = implode(', ', $_GET['type']);

}

/*Components*/

 if(isset($_GET['type_details']) && is_array($_GET['type_details'])){

 $model->type_details = implode(', ', $_GET['type_details']);

}

 /*Water filters*/

 if(isset($_GET['type_filter']) && is_array($_GET['type_filter'])){

 $model->type_filter = implode(', ', $_GET['type_filter']);

}

/*Water*/

 if(isset($_GET['type_water']) && is_array($_GET['type_water'])){

 $model->type_water = implode(', ', $_GET['type_water']);

}

 if(isset($_GET['water']) && is_array($_GET['water'])){

 $model->water = implode(', ', $_GET['water']);

}

 $this->filter = $this->renderPartial('application.views.shopCategory.filter_'.$_GET['alias'],array(
'model'=>$model),true);

 $this->render('index', array(
 'model' => $model,
));
 }


Model

protected function beforeFind() {

parent::beforeFind();

 if(isset($this->price_from) || isset($this->price_to)){
 $criteria = new CDbCriteria;
 $criteria->group = "cms_files.id_obj";
 $criteria->join = 'LEFT JOIN `shop_prices` shpr ON t.`id_price` = shpr.`id`;
 $criteria->condition = "1=1 ".($this->price_from?' AND shpr.price*'.(Yii::app()->controller->currency['value']).'>='.$this->price_from:").($this->price_to?' AND shpr.price*'.(Yii::app()->controller->currency['value']).'<='.$this->price_to:");
$this->getDbCriteria()->mergeWith($criteria);

}
...

public function search()
{
 // @todo Please modify the following code to remove attributes that should not be amazing.

 $criteria=new CDbCriteria;

$criteria->compare('id',$this->id);
$criteria->compare('prior',$this->prior);
$criteria->compare('name_ru',$this->name_ru,true);
$criteria->compare('alias',$this->alias,true);
$criteria->compare('description',$this->description_ru,true);
$criteria->compare('long_description',$this->long_description_ru,true);
$criteria->compare('id_price',$this->id_price);

$criteria->compare('prod_view',$this->prod_view);

 return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=>12,
),
));
 }
July 9th 19 at 13:35

Find more questions by tags PHPYii