diff --git a/library/mysql.php b/library/mysql.php index a5b3013..2e9b59d 100644 --- a/library/mysql.php +++ b/library/mysql.php @@ -349,7 +349,7 @@ class MySQL { return $query->fetch()->total; } - public function getHostPageIdSourcesByHostPageIdTarget(int $hostPageIdTarget, int $limit = 5) { + public function getHostPageIdSourcesByHostPageIdTarget(int $hostPageIdTarget, int $limit) { $query = $this->_db->prepare('SELECT * FROM `hostPageToHostPage` WHERE `hostPageIdTarget` = ? ORDER BY `quantity` DESC LIMIT ' . (int) $limit); diff --git a/public/search.php b/public/search.php index 9abdb9c..bdfd5eb 100644 --- a/public/search.php +++ b/public/search.php @@ -20,12 +20,13 @@ $t = !empty($_GET['t']) ? Filter::url($_GET['t']) : 'text'; $m = !empty($_GET['m']) ? Filter::url($_GET['m']) : 'default'; $q = !empty($_GET['q']) ? Filter::url($_GET['q']) : ''; $p = !empty($_GET['p']) ? (int) $_GET['p'] : 1; +$i = !empty($_GET['i']) ? (int) $_GET['i'] : 0; // Search request if (!empty($q)) { $resultsTotal = $sphinx->searchHostPagesTotal(Filter::searchQuery($q, $m), $t); - $results = $sphinx->searchHostPages(Filter::searchQuery($q, $m), $t, $p * WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT, WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT, $resultsTotal); + $results = $sphinx->searchHostPages(Filter::searchQuery($q, $m), $t, ($i ? 1 : $p * WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT), ($i ? 1 : WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT), ($i ? 1 : $resultsTotal)); } else { @@ -339,11 +340,15 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) { scheme . '://' . $hostPage->name . ($hostPage->port ? ':' . $hostPage->port : false)) . (mb_strlen(urldecode($hostPage->uri)) > 48 ? '...' . mb_substr(urldecode($hostPage->uri), -48) : urldecode($hostPage->uri))) ?> mime != 'text' && $totalHostPageIdSources = $db->getTotalHostPageIdSourcesByHostPageIdTarget($result->id)) { ?> -

- getHostPageIdSourcesByHostPageIdTarget($result->id) as $hostPageIdSource) { ?> +

+ + + +

+ getHostPageIdSourcesByHostPageIdTarget($result->id, ($i ? 1000 : 5)) as $j => $hostPageIdSource) { ?> getFoundHostPage($hostPageIdSource->hostPageIdSource)) { ?>

quantity, [sprintf(_('%s ref'), $hostPageIdSource->quantity), @@ -361,9 +366,9 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) { - +

- +