How do I theme the secondary menu?
You can theme secondary menu using THEME_links__system_secondary_menu like the following:

function THEME_links__system_secondary_menu(&amp;$vars) {
  // Get links:
  $links = $vars['links'];
  // Get the index of last menu item.
  end($links);
  $last_ele_index = key($links);
  // Here do your logic by change ...
  // $vars['links']['$last_ele_index'];
}