FOFModel::buildCountQuery

Builds the count query used in getTotal()