Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.394
diff -u -p -r1.394 menu.inc
--- includes/menu.inc	28 May 2010 10:18:57 -0000	1.394
+++ includes/menu.inc	31 May 2010 11:10:00 -0000
@@ -905,13 +905,13 @@ function menu_tree_output($tree) {
     }
   }

-  $num_items = count($items);
+  $last_item = count($items) - 1;
   foreach ($items as $i => $data) {
     $class = array();
     if ($i == 0) {
       $class[] = 'first';
     }
-    if ($i == $num_items - 1) {
+    if ($i == $last_item) {
       $class[] = 'last';
     }
     // Set a class if the link has children.
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.598
diff -u -p -r1.598 theme.inc
--- includes/theme.inc	19 May 2010 19:22:24 -0000	1.598
+++ includes/theme.inc	31 May 2010 11:10:02 -0000
@@ -1808,7 +1808,7 @@ function theme_item_list($variables) {

   if (!empty($items)) {
     $output .= "<$type" . drupal_attributes($attributes) . '>';
-    $num_items = count($items);
+    $last_item = count($items) - 1;
     foreach ($items as $i => $item) {
       $attributes = array();
       $children = array();
@@ -1835,7 +1835,7 @@ function theme_item_list($variables) {
       if ($i == 0) {
         $attributes['class'][] = 'first';
       }
-      if ($i == $num_items - 1) {
+      if ($i == $last_item) {
         $attributes['class'][] = 'last';
       }
       $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
