diff --git a/commands/command_logs.go b/commands/command_logs.go
index <HASH>..<HASH> 100644
--- a/commands/command_logs.go
+++ b/commands/command_logs.go
@@ -96,15 +96,17 @@ func sortedLogs() []string {
 		return []string{}
 	}
 
-	names := make([]string, 0, len(fileinfos))
+	names := make([]string, len(fileinfos))
+	fileCount := 0
 	for index, info := range fileinfos {
 		if info.IsDir() {
 			continue
 		}
+		fileCount += 1
 		names[index] = info.Name()
 	}
 
-	return names
+	return names[0:fileCount]
 }
 
 func init() {
can't modify the names array if its len is 0