Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.565
diff -u -F^f -r1.565 common.inc
--- includes/common.inc	23 Aug 2006 18:32:39 -0000	1.565
+++ includes/common.inc	24 Aug 2006 16:59:36 -0000
@@ -318,7 +318,8 @@ function drupal_site_offline() {
  */
 function drupal_not_found() {
   drupal_set_header('HTTP/1.0 404 Not Found');
-  watchdog('page not found', t('%page not found.', array('%page' => $_GET['q'])), WATCHDOG_WARNING);
+
+  watchdog('page not found', check_plain($_GET['q']), WATCHDOG_WARNING);
 
   // Keep old path for reference
   if (!isset($_REQUEST['destination'])) {
@@ -347,9 +348,9 @@ function drupal_not_found() {
  */
 function drupal_access_denied() {
   drupal_set_header('HTTP/1.0 403 Forbidden');
-  watchdog('access denied', t('%page denied access.', array('%page' => $_GET['q'])), WATCHDOG_WARNING, l(t('view'), $_GET['q']));
+  watchdog('access denied', check_plain($_GET['q']), WATCHDOG_WARNING);
 
-  // Keep old path for reference
+// Keep old path for reference
   if (!isset($_REQUEST['destination'])) {
     $_REQUEST['destination'] = $_GET['q'];
   }
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.193
diff -u -F^f -r1.193 search.module
--- modules/search/search.module	18 Aug 2006 18:58:46 -0000	1.193
+++ modules/search/search.module	24 Aug 2006 16:59:37 -0000
@@ -170,6 +170,10 @@ function search_menu($may_cache) {
       'callback arguments' => array('search_wipe_confirm'),
       'access' => user_access('administer search'),
       'type' => MENU_CALLBACK);
+    $items[] = array('path' => 'admin/logs/search', 'title' => t('search events'),
+      'description' => t('View the search terms.'),
+      'callback' => 'watchdog_top',
+      'callback arguments' => array('search'));
   }
   else if (arg(0) == 'search') {
     // To remember the user's search keywords when switching across tabs,
@@ -920,7 +924,7 @@ function search_view() {
     // Only perform search if there is non-whitespace search term:
     if (trim($keys)) {
       // Log the search keys:
-      watchdog('search', t('Search: %keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys));
+      watchdog('search', t('%keys (@type).', array('%keys' => $keys, '@type' => module_invoke($type, 'search', 'name'))), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys));
 
       // Collect the search results:
       $results = search_data($keys, $type);
Index: modules/watchdog/watchdog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/watchdog/watchdog.module,v
retrieving revision 1.151
diff -u -F^f -r1.151 watchdog.module
--- modules/watchdog/watchdog.module	23 Aug 2006 18:16:45 -0000	1.151
+++ modules/watchdog/watchdog.module	24 Aug 2006 16:59:37 -0000
@@ -47,10 +47,18 @@ function watchdog_menu($may_cache) {
       'callback' => 'system_admin_menu_block_page',
       'weight' => 5,
       'position' => 'left');
-    $items[] = array('path' => 'admin/logs/watchdog', 'title' => t('watchdog log'),
-      'description' => t('View the primary system log.'),
-      'weight' => -10,
-      'callback' => 'watchdog_overview');
+    $items[] = array('path' => 'admin/logs/watchdog', 'title' => t('recent events'),
+      'description' => t('View all recent events in the system in reverse chronological order.'),
+      'callback' => 'watchdog_overview',
+      'weight' => -1);
+    $items[] = array('path' => 'admin/logs/page-not-found', 'title' => t('page not found events'),
+      'description' => t('View the page not found events (404s).'),
+      'callback' => 'watchdog_top',
+      'callback arguments' => array('page not found'));
+    $items[] = array('path' => 'admin/logs/access-denied', 'title' => t('access denied events'),
+      'description' => t('View the access denied events (403s).'),
+      'callback' => 'watchdog_top',
+      'callback arguments' => array('access denied'));
     $items[] = array('path' => 'admin/logs/event', 'title' => t('details'),
       'callback' => 'watchdog_event',
       'type' => MENU_CALLBACK);
@@ -160,6 +168,29 @@ function watchdog_overview() {
   return $output;
 }
 
+function watchdog_top($type) {
+
+  $header = array(
+    array('data' => t('Count'), 'field' => 'count', 'sort' => 'desc'),
+    array('data' => t('Message'), 'field' => 'message')
+  );
+
+  $result = pager_query("SELECT COUNT(wid) AS count, message FROM {watchdog} WHERE type = '%s' GROUP BY message ". tablesort_sql($header), 50, 0, NULL, $type);
+
+  while ($watchdog = db_fetch_object($result)) {
+    $rows[] = array($watchdog->count, truncate_utf8($watchdog->message, 56, TRUE, TRUE));
+  }
+
+  if (!$rows) {
+    $rows[] = array(array('data' => t('No log messages available.'), 'colspan' => 6));
+  }
+
+  $output  = theme('table', $header, $rows);
+  $output .= theme('pager', NULL, 50, 0);
+
+  return $output;
+}
+
 function theme_watchdog_form_overview($form) {
   return '<div class="container-inline">'. drupal_render($form) .'</div>';
 }
