=== modified file 'includes/path.inc'
--- includes/path.inc	2008-06-24 20:43:26 +0000
+++ includes/path.inc	2008-06-24 21:27:55 +0000
@@ -42,18 +42,18 @@
 function drupal_lookup_path($action, $path = '') {
   // $map keys are Drupal paths and the values are the corresponding aliases
   static $map = array(), $no_src = array();
-  static $count;
+  static $has_paths;
 
-  // 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}'));
+  // Use $has_paths to avoid looking up paths in subsequent calls if there simply are no aliases
+  if (!isset($has_paths)) {
+    $has_paths = db_result(db_query_range('SELECT dst FROM {url_alias}', 0, 1));
   }
 
   if ($action == 'wipe') {
     $map = array();
     $no_src = array();
   }
-  elseif ($count > 0 && $path != '') {
+  elseif ($has_paths && $path != '') {
     if ($action == 'alias') {
       if (isset($map[$path])) {
         return $map[$path];

