Fixed bounds check for log dir scan