Fix some stuff from recent pull requests
diff --git a/system/core/Log.php b/system/core/Log.php
index 0749de8..a84d3dc 100644
--- a/system/core/Log.php
+++ b/system/core/Log.php
@@ -73,6 +73,13 @@
 	protected $_date_fmt		= 'Y-m-d H:i:s';
 
 	/**
+	 * Filename extension
+	 *
+	 * @var	string
+	 */
+	protected $_file_ext;
+
+	/**
 	 * Whether or not the logger can write to the log files
 	 *
 	 * @var bool
@@ -86,8 +93,10 @@
 	 */
 	protected $_levels		= array('ERROR' => 1, 'DEBUG' => 2, 'INFO' => 3, 'ALL' => 4);
 
+	// --------------------------------------------------------------------
+
 	/**
-	 * Initialize Logging class
+	 * Class constructor
 	 *
 	 * @return	void
 	 */
@@ -96,8 +105,8 @@
 		$config =& get_config();
 
 		$this->_log_path = ($config['log_path'] !== '') ? $config['log_path'] : APPPATH.'logs/';
-
-		$this->_log_ext = ($config['log_file_extension'] !== '') ? ltrim($config['log_file_extension'], '.') : $this->_log_ext;
+		$this->_file_ext = (isset($config['log_file_extension']) && $config['log_file_extension'] !== '')
+			? ltrim($config['log_file_extension'], '.') : 'php';
 
 		file_exists($this->_log_path) OR mkdir($this->_log_path, DIR_WRITE_MODE, TRUE);
 
@@ -149,15 +158,16 @@
 			return FALSE;
 		}
 
-		$filepath = $this->_log_path.'log-'.date('Y-m-d').'.php';
-		$message  = '';
+		$filepath = $this->_log_path.'log-'.date('Y-m-d').'.'.$this->_file_ext;
+		$message = '';
 
 		if ( ! file_exists($filepath))
 		{
 			$newfile = TRUE;
-			if($this->_log_ext === 'php')
+			// Only add protection to php files
+			if ($this->_file_ext === 'php')
 			{
-				$message .= '<'."?php defined('BASEPATH') OR exit('No direct script access allowed'); ?".">\n\n";
+				$message .= "<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>\n\n";
 			}
 		}