Fix: Add guard to prevent division by zero at line 2359

The max_bot_traffic variable is extracted from a file which could
theoretically contain all zeros, causing division by zero. Added:
  max_bot_traffic=${max_bot_traffic:-1}

This ensures the denominator is never zero while preserving the
intended logic when valid data exists.
This commit is contained in:
Developer
2026-04-23 21:27:06 -04:00
parent 9471355e77
commit cf362c2adf
+1
View File
@@ -2352,6 +2352,7 @@ generate_report() {
echo ""
echo "Bot Traffic Timeline (hourly):"
max_bot_traffic=$(awk '{print $1}' "$TEMP_DIR/hourly_bot_traffic.txt" | sort -rn | head -1)
max_bot_traffic=${max_bot_traffic:-1} # Prevent division by zero
while read -r line; do
count=$(echo "$line" | awk '{print $1}')
hour=$(echo "$line" | awk '{print $2}')