Permalink
Browse files

Precount for performance

  • Loading branch information...
1 parent 1f200da commit 32ee1a2dfdc01b6fca6689a410cb309185808a03 unknown committed Aug 14, 2011
Showing with 6 additions and 4 deletions.
  1. +6 −4 catalog/includes/classes/navigation_history.php
@@ -26,7 +26,8 @@ function add_current_page() {
global $request_type, $cPath;
$set = 'true';
- for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {
+ $n=sizeof($this->path);
+ for ($i=0; $i<$n; $i++) {
if ( ($this->path[$i]['page'] == basename($_SERVER['PHP_SELF'])) ) {
if (isset($cPath)) {
if (!isset($this->path[$i]['get']['cPath'])) {
@@ -39,8 +40,8 @@ function add_current_page() {
} else {
$old_cPath = explode('_', $this->path[$i]['get']['cPath']);
$new_cPath = explode('_', $cPath);
-
- for ($j=0, $n2=sizeof($old_cPath); $j<$n2; $j++) {
+ $n2=sizeof($old_cPath);
+ for ($j=0; $j<$n2; $j++) {
if ($old_cPath[$j] != $new_cPath[$j]) {
array_splice($this->path, ($i));
$set = 'true';
@@ -102,7 +103,8 @@ function set_path_as_snapshot($history = 0) {
}
function debug() {
- for ($i=0, $n=sizeof($this->path); $i<$n; $i++) {
+ $n=sizeof($this->path);
+ for ($i=0; $i<$n; $i++) {
echo $this->path[$i]['page'] . '?';
foreach($this->path[$i]['get'] as $key => $value) {

0 comments on commit 32ee1a2

Please sign in to comment.