diff -r 4f22f097ec96 -r 6ab8a344168c filebrowser.module
--- a/filebrowser.module	Thu Mar 20 11:41:23 2008 +0300
+++ b/filebrowser.module	Thu Mar 20 11:52:28 2008 +0300
@@ -109,9 +109,14 @@ function filebrowser_page($path) {
     }
   }
   
-  $output = theme('table', array(t('Name'), t('Size')), $files);
+  $header = array(t('Name'), t('Size'));
+  $output = theme('filebrowser_page', $files, $header);
   
-  $output .= '<p>'. t('Contains @fc files totaling @ds in size', array('@fc' => count($files), '@ds' => format_size($total_size))) .'</p>';  
+  if (!empty($output)) {
+    $output .= '<p>'. t('Contains @fc files totaling @ds in size', array('@fc' => count($files), '@ds' => format_size($total_size))) .'</p>';  
+  } else {
+    $output = '<p>'. t('This directory is empty.') .'</p>';
+  }
   
   return $output;
 }
@@ -286,6 +291,9 @@ function theme_filebrowser_admin_setting
  */
 function filebrowser_theme() {
   return array(
+    'filebrowser_page' => array(
+      'arguments' => array('files' => NULL, 'header' => NULL)
+    ),
     'filebrowser_admin_settings' => array(
       'arguments' => array('form' => NULL)
     )
@@ -319,4 +327,18 @@ function _filebrowser_dir_stats($dir) {
   }
   
   return array('file_count' => $file_count, 'total_size' => $total_size);
+}
+
+/**
+ * Theme a filebrowser page, if files are available or not.
+ * Here you have some possibility to reformat the data or the table layout.
+ */
+function theme_filebrowser_page(&$files, $header = NULL) {
+  if ($files) {
+    // CSS can hook on this ID to style table elements differently
+    return theme("table", $header, $files, array('id' => 'filebrowser-table'));
+  }
+  else {
+    return '';
+  }
 }
