system/classes/Repository.php
public function count($coraDbQuery = false)
    {
        // If no query builder object was passed in, then grab the gateway's.
        if (!$coraDbQuery) {
            $coraDbQuery = $this->gateway->getDb();
        }
        $coraDbQuery = $this->model::model_constraints($coraDbQuery);
        return $this->gateway->count($coraDbQuery);
    }
public function count($coraDbQuery = false)
    {
        // If no query builder object was passed in, then grab the gateway's.
        if (!$coraDbQuery) {
            $coraDbQuery = $this->gateway->getDb();
        }
        $coraDbQuery = $this->model::model_constraints($coraDbQuery);
        return $this->gateway->count($coraDbQuery);
    }
Count the number of results, optionally with query limiters.