CActiveDataProvider do wrong query for count

Well, I got simple query

$criteria = new CDbCriteria();
$criteria->condition = ‘pay_card=0 OR (pay_card=1 and status=:status)’;
$criteria->params = [’:status’ => OrderMain::STATUS_PAYED];
$criteria->group = ‘order_date’;
$criteria->order = ‘order_date desc’;
return new CActiveDataProvider(‘OrderMain’, [
‘criteria’ => $criteria
]);

CActiveDataProvider tries to get the total number of records using a query by wrapping select into count()
But in my case it do really strange query:

SELECT COUNT(*) FROM (SELECT * FROM order_main t WHERE (t.deleted_at is null and t.is_archive = 0) AND (pay_card=0 OR (pay_card=1 and status=1)) GROUP BY order_date) sq

but I remember such queries was like

SELECT count(*) FROM order_main t WHERE (t.deleted_at is null and t.is_archive = 0) AND (pay_card=0 OR (pay_card=1 and status=1)) GROUP BY order_date

how to fix count query ?

countCriteria?
https://www.yiiframework.com/doc/api/1.1/CActiveDataProvider

tnx, I’ll try