public function getNumPages($table, $limit = 100, $where = array(), $search = "", $fields = array())
 {
     $table_whitelist = array("team", "organization_user", "feed_entry");
     $where["organization_id"] = $this->organization_id;
     if ($table !== "organization_user") {
         $where["organization_domain_id"] = $this->organization_domain_id;
     }
     $where = DBHandler::createWhereString($where, "t");
     if (strlen($search)) {
         $where = DBHandler::addSearchToWhere($where, "t", $fields, $search);
     }
     $res = $this->dbh->query("SELECT COUNT(t.id) as count FROM `{$table}` t WHERE {$where[0]}", $where[1]);
     if (!count($res)) {
         $res = array(array("count" => 0));
     }
     return max(1, ceil($res[0]["count"] / $limit));
 }