--- pgplus.orig/src/last.c	Sat Jun 20 10:44:06 1998
+++ pgplus/src/last.c	Fri Jun 26 10:06:38 1998
@@ -35,6 +35,7 @@
 typedef struct lastinfo lastinfo;
 
 lastinfo Wtmp[LAST_KEPT];
+int total = 0;			/* How many people logged */
 
 char *diff_time(int, int);
 
@@ -86,6 +87,7 @@
     return;
 
   Wtmp[i].out = time(0);
+  total++;
 }
 
 void viewLast(player * p, char *str)
@@ -93,10 +95,6 @@
   int i, j, hit = 0;
   char *oldstack = stack, top[70];
 
-  sprintf(top, "Last %d connections to %s", LAST_SHOW,
-	  get_config_msg("talker_name"));
-  pstack_mid(top);
-
   if (*str && isdigit(*str))
   {
     j = atoi(str);
@@ -111,6 +109,18 @@
   else
     j = LAST_SHOW;
 
+  if (j > total)
+     j = total;
+
+  if (total == 0)
+  {
+    tell_player(p, "No connections logged.\n");
+    return;
+  }
+
+  sprintf(top, "Last %d connections to %s", j,
+          get_config_msg("talker_name"));
+  pstack_mid(top);
 
   for (i = 0; (i < LAST_KEPT && hit < j); i++)
   {