code: public function getTotalCount()
      {
          if ($this->getPagination() === false) {
              return $this->getCount();
          } elseif ($this->_totalCount === null) {
              $this->_totalCount = $this->prepareTotalCount();
          }
  
          return $this->_totalCount;
      }
docs: Returns the total number of data models.
  When [[pagination]] is false, this returns the same value as [[count]].
  Otherwise, it will call [[prepareTotalCount()]] to get the count.
  @return int total number of possible data models.