Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.515
diff -u -r1.515 common.inc
--- includes/common.inc	10 Feb 2006 05:25:57 -0000	1.515
+++ includes/common.inc	15 Feb 2006 04:18:10 -0000
@@ -1008,7 +1008,10 @@
  *   an HTML string containing a link to the given path.
  */
 function l($text, $path, $attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE) {
-  if ($path == $_GET['q']) {
+  // Compare path + query to current page + query, but don't override $path or $query, they are sent to url() below
+  // To get the correct current page + query, take the full query string minus the 'q=' part
+  $query_check = ($query != '') ? '&' . $query : '';
+  if (($path . $query_check) == substr($_SERVER['QUERY_STRING'], 2)) {
     if (isset($attributes['class'])) {
       $attributes['class'] .= ' active';
     }
