Index: path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.19 diff -u -p -r1.19 path.inc --- path.inc 4 Nov 2007 16:42:45 -0000 1.19 +++ path.inc 4 Dec 2007 21:00:14 -0000 @@ -46,20 +46,20 @@ function drupal_init_path() { function drupal_lookup_path($action, $path = '', $path_language = '') { global $language; // $map is an array with language keys, holding arrays of Drupal paths to alias relations - static $map = array(), $no_src = array(), $count; + static $map = array(), $no_src = array(), $have_rows; $path_language = $path_language ? $path_language : $language->language; // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases - if (!isset($count)) { - $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}')); + if (!isset($have_rows)) { + $have_rows = db_result(db_query('SELECT pid FROM {url_alias} LIMIT 1')); } if ($action == 'wipe') { $map = array(); $no_src = array(); } - elseif ($count > 0 && $path != '') { + elseif ($have_rows && $path != '') { if ($action == 'alias') { if (isset($map[$path_language][$path])) { return $map[$path_language][$path];