public function total()
	{
		// Note that we do not need to parse includes at this stage, as includes do not effect
		// the primary result set, and thus do not effect the count. whereRelated() could effect
		// the count, but that method is not currently in use.
		//
		// We also reset the 'select' clause to avoid pulling unnecessary records and reset
		// the 'order by' clause to avoid referenced fields in the aforementioned 'select' clauses
		// that mgiht have been removed. Neither of these should have any effect on a count.
		$first = $this->deselect()
		              ->select($this->getQualifiedFieldName($this->getPrimaryKey()), 'count', true)
		              ->unordered()
		              ->rows(false)
		              ->first();
		              //->count;

		$total = $first ? (int)$first->count : 0;

		$this->reset();

		return $total;
	}