Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.428
diff -u -p -r1.428 menu.inc
--- includes/menu.inc	8 Dec 2010 06:48:39 -0000	1.428
+++ includes/menu.inc	13 Dec 2010 21:33:09 -0000
@@ -2303,11 +2303,25 @@ function menu_set_active_trail($new_trai
       }
       list($key, $curr) = each($tree);
     }
-    // Make sure the current page is in the trail (needed for the page title),
-    // if the link's type allows it to be shown in the breadcrumb. Also exclude
-    // it if we are on the front page.
+    // Make sure the current page is in the trail (since its needed for the page
+    // title), don't add it if we are on the front page (since its already in
+    // the trail).
+    //
+    // See #965272: The title for a page is determined by taking the last item in the
+    // active path which is not a local task. The active path is seeded with a
+    // link to home and each item in the path with type
+    // MENU_VISIBLE_IN_BREADCRUMB is added to the list.
+    // At the end of this process the preferred link for the current item is
+    // added to the end of the breadcrumb if it is flagged as
+    // MENU_VISIBLE_IN_BREADCRUMB or MENU_CALLBACK. If we don't do this,
+    // items of type MENU_CALLBACK without parents will result in the page title
+    // being Home- as this would be the only item in the active path. Adding the
+    // preferred link to the breadcrumb trail even if it is only a MENU_CALLBACK
+    // does not have an adverse affect on the breadcrumbs as the current page
+    // is always dropped from the breadcrumb trail anyway
     $last = end($trail);
-    if ($last['href'] != $preferred_link['href'] && ($preferred_link['type'] & MENU_VISIBLE_IN_BREADCRUMB) == MENU_VISIBLE_IN_BREADCRUMB && !drupal_is_front_page()) {
+    if ($last['href'] != $preferred_link['href'] && !drupal_is_front_page() &&
+        in_array($last['type'], array(MENU_CALLBACK, MENU_VISIBLE_IN_BREADCRUMB), TRUE)) {
       $trail[] = $preferred_link;
     }
   }
Index: modules/simpletest/tests/menu.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu.test,v
retrieving revision 1.42
diff -u -p -r1.42 menu.test
--- modules/simpletest/tests/menu.test	2 Dec 2010 17:34:24 -0000	1.42
+++ modules/simpletest/tests/menu.test	13 Dec 2010 21:33:12 -0000
@@ -33,6 +33,16 @@ class MenuRouterTestCase extends DrupalW
     $this->assertText('A title with @placeholder', t('Raw text found on the page'));
     $this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), t('Text with placeholder substitutions not found.'));
   }
+  
+  /**
+   * Test title is set correctly on orphan (no parents)
+   * items of type MENU_CALLBACK and not 'Home'
+   * @see http://drupal.org/node/965272
+   */
+  function testTitleOrphanMenuCallback() {
+    $this->drupalGet('menu_callback_orphan');
+    $this->assertText('Menu Callback Orphan', t('Raw text found on the page'));
+  }
 
   /**
    * Test the theme callback when it is set to use an administrative theme.
Index: modules/simpletest/tests/menu_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/menu_test.module,v
retrieving revision 1.21
diff -u -p -r1.21 menu_test.module
--- modules/simpletest/tests/menu_test.module	2 Dec 2010 17:34:24 -0000	1.21
+++ modules/simpletest/tests/menu_test.module	13 Dec 2010 21:33:12 -0000
@@ -16,6 +16,12 @@ function menu_test_menu() {
     'page callback' => 'node_save',
     'menu_name' => menu_test_menu_name(),
   );
+  //This item is of type MENU_CALLBACK with no parents to test title
+  //is set correctly - @see http://drupal.org/node/965272
+  $items['menu_callback_orphan'] = array(
+    'title' => 'Menu Callback Orphan',
+    'page callback' => 'node_page_default',
+  );
   // Use FALSE as 'title callback' to bypass t().
   $items['menu_no_title_callback'] = array(
     'title' => 'A title with @placeholder',
