--- content_moderation_orig.module	2010-05-01 08:53:19.000000000 -0400
+++ content_moderation.module	2010-08-13 09:22:10.000000000 -0400
@@ -97,7 +97,12 @@ function content_moderation_block($op = 
             $links['live_view'] = 'node/'.$live->nid;
           }
           $links['edit_state'] = _content_moderation_change_state_link($node->vid,$node->nid);
-          $links['compare_with_live'] = "node/{$node->nid}/revisions/view/{$node->vid}/{$live->vid}";
+          
+          $check_revisions = _content_moderation_get_latest_revisions($node->nid, 2);
+
+          $rev_url = _content_moderation_determine_revision_url($check_revisions, $node->nid, $node->vid, FALSE);
+          
+          $links['compare_with_live'] = $rev_url . $live->vid;
 
           // Get the state of the currently view revision
           $state = ucfirst(_content_moderation_current_state($node->vid));
@@ -217,7 +222,7 @@ function content_moderation_nodeapi(&$no
         // If this node has no live version yet, notice the user that the content is not valid.
         // Valid reasons are, that the node has been just created and not approved or, that all live
         // revisions have been revoked
-        drupal_set_message ( t('The content of this document has not been approved and is therefor not valid yet!'), 'warning' );
+        drupal_set_message ( t('The content of this document has not been approved and is therefore not valid yet!'), 'warning' );
       }
 
       // If we are showing a revision, show the author informations
@@ -395,11 +400,13 @@ function theme_content_moderation_node_h
     $user = user_load($e->uid);
     $state_class = "state_{$e->state_name}";
     // TODO: proper localized date format
+    $revisions = _content_moderation_get_latest_revisions($e->nid, 2);
+    $rev_url = _content_moderation_determine_revision_url($revisions, $e->nid, $e->vid);
     $data[] = array (
       format_date($e->stamp,'small'),                         // date
       l($user->name,"user/{$user->uid}"),                     // Who changed that state?
       "<span class='$state_class'>".ucfirst(t('!old',array('!old' => $e->old_state_name))).' -> '.ucfirst(t($e->state_name)).'</span>',             // Transition
-      l($e->vid,"node/{$e->nid}/revisions/{$e->vid}/view")   // revision
+      l($e->vid,$rev_url)   // revision
     );
   }
   $title = t('Moderation history');
@@ -704,12 +711,30 @@ function _content_moderation_get_current
 }
 
 function _content_moderation_show_latest_revision($node) {
-  $revisions = _content_moderation_get_latest_revisions($node->nid,1);
+  $revisions = _content_moderation_get_latest_revisions($node->nid, 2);
   $node = node_load($node->nid,$revisions[0]->vid);
-  menu_set_active_item("node/{$node->nid}/revisions/{$node->vid}/view");
+  $rev_url = _content_moderation_determine_revision_url($revisions, $node->nid, $node->vid);
+  menu_set_active_item($rev_url);
   return node_page_view($node);
 }
 
+// created from issue #792202
+function _content_moderation_determine_revision_url($revisions, $nid, $vid, $view = TRUE) {
+	// Adding logic to determine if there is already a live version as well
+	// If there is only 1 revision and no live version then we change the rev_url
+	$live = _content_moderation_live_revision($nid);
+  if (count($revisions) == 1 && $live->vid == '') {
+    $rev_url = "node/{$nid}";
+  }
+  else {
+    $rev_url = "node/{$nid}/revisions/{$vid}/";
+    if ($view == TRUE) {
+        $rev_url .= "view";
+    }
+  }
+  return $rev_url;
+}
+
 function _content_moderation_has_moderated_revisions($nid) {
   $none_state = _content_moderation_none_state();
   $live_state = _content_moderation_live_state();
