Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.372
diff -u -p -r1.372 theme.inc
--- includes/theme.inc	28 Aug 2007 11:35:33 -0000	1.372
+++ includes/theme.inc	29 Aug 2007 15:01:47 -0000
@@ -1096,27 +1096,19 @@ function theme_links($links, $attributes
     $i = 1;
 
     foreach ($links as $key => $link) {
-      $class = '';
+      $class = $key;
 
-      // Automatically add a class to each link and also to each LI
-      if (isset($link['attributes']) && isset($link['attributes']['class'])) {
-        $link['attributes']['class'] .= ' '. $key;
-        $class = $key;
-      }
-      else {
-        $link['attributes']['class'] = $key;
-        $class = $key;
-      }
-
-      // Add first and last classes to the list of links to help out themers.
-      $extra_class = '';
+      // Add first, last and active classes to the list of links to help out themers.
       if ($i == 1) {
-        $extra_class .= 'first ';
+        $class .= ' first';
       }
       if ($i == $num_links) {
-        $extra_class .= 'last ';
+        $class .= ' last';
+      }
+      if ($link['href'] == $_GET['q']) {
+        $class .= ' active';
       }
-      $output .= '<li class="'. $extra_class . $class .'">';
+      $output .= '<li class="'. $class .'">';
 
       if (isset($link['href'])) {
         // Pass in $link as $options, they share the same keys.
@@ -1127,7 +1119,11 @@ function theme_links($links, $attributes
         if (empty($link['html'])) {
           $link['title'] = check_plain($link['title']);
         }
-        $output .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
+        $span_attributes = '';
+        if (isset($link['attributes'])) {
+          $span_attributes = drupal_attributes($link['attributes']);
+        }
+        $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
       }
 
       $i++;
