Index: pathauto_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto_node.inc,v
retrieving revision 1.29.4.23
diff -u -p -r1.29.4.23 pathauto_node.inc
--- pathauto_node.inc	16 Dec 2007 21:57:13 -0000	1.29.4.23
+++ pathauto_node.inc	22 Jan 2008 06:35:00 -0000
@@ -55,7 +55,7 @@ function node_pathauto_bulkupdate() {
     if (trim($pattern)) {
       $pattern_types[] = $type;
       if (!trim($type_where)) {
-        $type_where = " AND (type = '%s' ";
+        $type_where = " (type = '%s' ";
       }
       else {
         $type_where .= " OR type = '%s'";
@@ -64,15 +64,16 @@ function node_pathauto_bulkupdate() {
   }
   $type_where .= ')';
 
-  $query = "SELECT nid, type, title, uid, created, src, dst, vid FROM {node} LEFT JOIN {url_alias} ON CONCAT('node/', nid) = src WHERE src IS NULL ". $type_where;
-  $result = db_query_range($query, $pattern_types, 0, variable_get('pathauto_max_bulk_update', 50));
+  $query = 'SELECT nid, vid, type, title, uid, created FROM {node} WHERE '. $type_where .' ORDER BY nid ASC';
+  $result = db_query($query, $pattern_types);
 
   $count = 0;
   $placeholders = array();
-  while ($node_ref = db_fetch_object($result)) {
+  while (($node_ref = db_fetch_object($result)) && ($count < variable_get('pathauto_max_bulk_update', 50))) {
     $node = node_load($node_ref->nid, NULL, TRUE);
-    $node->src = $node_ref->src;
-    $node->dst = $node_ref->dst;
+    if (!empty($node->path)) {
+      continue;
+    }
     if (module_exists('taxonomy')) {
         // Must populate the terms for the node here for the category
         // placeholders to work
