Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination for categories doesn’t work #137

Closed
interkosmos opened this issue Feb 12, 2020 · 2 comments
Closed

Pagination for categories doesn’t work #137

interkosmos opened this issue Feb 12, 2020 · 2 comments

Comments

@interkosmos
Copy link

Opening an arbitrary category and selecting a page > 1 still shows only the first page. For example:

https://www.freshports.org/games/?page=2

@dlangille
Copy link
Contributor

This also affects paging of commits.

I think it's REDIRECT_QUERY_STRING and QUERY_STRING no longer working on later PHP.

FYI, this is the fix for categories:

[dan@dev-nginx01:/usr/local/www/freshports/rewrite] $ git diff missing-category.php
diff --git a/rewrite/missing-category.php b/rewrite/missing-category.php
index 35c1c367..e857c0ee 100644
--- a/rewrite/missing-category.php
+++ b/rewrite/missing-category.php
@@ -84,13 +84,23 @@ function freshports_CategoryDisplay($db, $category, $PageNo = 1, $PageSize = DEF
        header('HTTP/1.1 200 OK');
 
        $Debug = 0;
-
-       if (IsSet($_SERVER['REDIRECT_QUERY_STRING'])) {
-               if (IsSet($_SERVER["REDIRECT_QUERY_STRING"])) {
-                       parse_str($_SERVER['REDIRECT_QUERY_STRING'], $query_parts);
-                       if (IsSet($query_parts['page']))      $PageNo   = $query_parts['page'];
-                       if (IsSet($query_parts['page_size'])) $PageSize = $query_parts['page_size'];
+       
+       if (IsSet($_SERVER['REQUEST_URI'])) {
+               $url_query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
+               if ($Debug) {
+                       echo '<pre>url_query is';
+                       var_dump($url_query);
+                       echo '</pre>';
                }
+               parse_str($url_query, $url_args);
+               if ($Debug) {
+                       echo '<pre>url_args is';
+                       var_dump($url_args);
+                       echo '</pre>';
+               }
+
+               if (IsSet($url_args['page']))      $PageNo   = $url_args['page'];
+               if (IsSet($url_args['page_size'])) $PageSize = $url_args['page_size'];
        }
 
        if (!IsSet($page) || $page == '') {
[dan@dev-nginx01:/usr/local/www/freshports/rewrite] $ 

@dlangille
Copy link
Contributor

This also affects non-ports, such /Mk/bsd.port.mk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants