mirror of
https://github.com/neocities/neocities.git
synced 2025-08-04 08:42:00 +02:00
New stats needs to escape gets newline
This commit is contained in:
parent
9affb83a2c
commit
c5d62b19a3
2 changed files with 23 additions and 22 deletions
|
@ -20,20 +20,11 @@ class Stat < Sequel::Model
|
|||
logfile = File.open log_path, 'r'
|
||||
|
||||
while hit = logfile.gets
|
||||
hit_array = hit.split ' '
|
||||
hit_array = hit.strip.split "\t"
|
||||
|
||||
# If > 6, then the path has a space in it, combine.
|
||||
if hit_array.length > 6
|
||||
time = hit_array[0]
|
||||
username = hit_array[1]
|
||||
size = hit_array[2]
|
||||
path_end_length = 3 + (hit_array.length - 6)
|
||||
path = hit_array[3..path_end_length].join ' '
|
||||
ip = hit_array[path_end_length+1]
|
||||
referrer = hit_array[path_end_length+2]
|
||||
else
|
||||
time, username, size, path, ip, referrer = hit_array
|
||||
end
|
||||
raise ArgumentError, hit.inspect if hit_array.length > 6
|
||||
|
||||
time, username, size, path, ip, referrer = hit_array
|
||||
|
||||
next if !referrer.nil? && referrer.match(/bot/i)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue