Index: trunk/kernel/include/parseditem.php =================================================================== diff -u -N -r3402 -r3465 --- trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 3402) +++ trunk/kernel/include/parseditem.php (.../parseditem.php) (revision 3465) @@ -1589,7 +1589,6 @@ function Query_Item($sql,$limit = null, $fix_method = 'set_first') { - global $n_var_list; // query itemlist (module items) using $sql specified // apply direct limit clause ($limit) or calculate it if not specified // fix invalid page in case if needed by method specified in $fix_method @@ -1602,10 +1601,7 @@ { //echo "page fix pre (class: ".get_class($this).")
"; $this->QueryItemCount = QueryCount($sql); // must get total item count before fixing - if ($n_var_list['p']) - { - $fix_method = 'set_current'; - } + $this->FixInvalidPage($fix_method); // specially made for cats delete @@ -1665,9 +1661,19 @@ return $PerPage; } + /** + * Returns current page from env var + * + * @return int + */ + function getEnvPage() + { + $var_name = preg_replace('/(.*)_update$/', '\\1', $this->PageEnvar); + return $GLOBALS[$var_name]['p']; + } + function FixInvalidPage($fix_method = 'set_first') { - global $n_var_list; // in case if current page > total page count, // then set current page to last possible "set_last" // or first possible "set_first" @@ -1679,7 +1685,10 @@ echo "PerPage: $PerPage
"; echo "Items Queries: ".$this->QueryItemCount."
"; echo "=====
"; -*/ +*/ + +// if ( $this->getEnvPage() ) $fix_method = 'set_current'; + if( ($this->Page > $NumPages || $this->Page == 0) && $PerPage != -1) { switch($fix_method) @@ -1693,7 +1702,7 @@ //echo "Move 2 Last (class ".get_class($this).")
"; break; case 'set_current': - $this->Page = $n_var_list['p']; + $this->Page = $this->getEnvPage(); //echo "Move 2 Page reflected in env (class ".get_class($this).")
"; break; }