--- C:/Documents and Settings/Raxiux/Desktop/wikitools/wikitools.pages.inc	Wed Jun 17 22:08:36 2009
+++ C:/xampp/htdocs/drupal/sites/all/modules/contrib/wikitools/wikitools.pages.inc	Wed Jul  8 00:36:15 2009
@@ -54,8 +54,10 @@
   // Don't do anything if no node types are active or no page name is available
   $node_types = wikitools_node_types();
   if (count($node_types) && $page_name) {
-    // Try to find the current page with this name.
-    $result = db_query("SELECT nid, type FROM {node} WHERE LOWER(title) = LOWER('%s')", $page_name);
+    // Try to find the current page with this name, limit the query by node types
+    $params = $node_types;
+    $params[] = $page_name;
+    $result = db_query("SELECT nid, type FROM {node} WHERE type IN (". db_placeholders($node_types, 'varchar') .") AND LOWER(title) = LOWER('%s')", $params);
     $found_nodes = array();
     while ($node = db_fetch_object($result)) {
       if (wikitools_type_affected($node->type)) {
