0) { return $foundId[0]->WID; } return 0; } static function getNextPageId(string $url, string $date) : int { $foundId = Table::_get_all( "Webpages", "Database\Webpage", "WHERE URL = \"$url\" && Date > \"$date\" ORDER BY Date ASC LIMIT 1", "WID" ); if (count($foundId) > 0) { return $foundId[0]->WID; } return 0; } static function getPagesCount() : int { return Table::_get_entries_count("Webpages"); } static function mostVisited(int $count) : array { return Table::_get_all( 'Webpages', 'Database\Webpage', "GROUP BY URL ORDER BY Visits DESC, Date DESC LIMIT $count", 'WID,Path,URL,Date,MAX(Visits) as Visits,RequesterUID,FaviconPath,Title' ); } static function allArchives(string $URL) : array { return Table::_get_all( 'Webpages', 'Database\Webpage', "WHERE URL = \"$URL\" ORDER BY Date DESC" ); } static function allArchivesByUser(int $UID) : array { return Table::_get_all( 'Webpages', 'Database\Webpage', "WHERE RequesterUID = \"$UID\" ORDER BY Date DESC" ); } static function getArchivePathsByPattern(string $URLPattern) : array { return Table::_get_all( 'Webpages', 'Database\Webpage', "WHERE URL LIKE \"$URLPattern\" ORDER BY Date DESC", "Path, WID" ); } function incrementVisits() { Table::_update( 'Webpages', "Visits = \"" . ($this->Visits + 1) . "\"", "WID = \"{$this->WID}\"" ); } }