Merge pull request #1549 from chrisguiney/session_gc

Allow session garbace collection percentage to be configured.
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 72a942b..af38dc3 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -155,12 +155,6 @@
 	 */
 	public $time_reference			= 'local';
 
-	/**
-	 * Probablity level of garbage collection of old sessions
-	 *
-	 * @var int
-	 */
-	public $gc_probability			= 5;
 
 	/**
 	 * Session data
@@ -940,8 +934,11 @@
 			return;
 		}
 
+		$probability = ini_get('session.gc_probability');
+		$divisor = ini_get('session.gc_divisor');
+
 		srand(time());
-		if ((rand() % 100) < $this->gc_probability)
+		if ((mt_rand(0, $divisor) / $divisor) < $probability)
 		{
 			$expire = $this->now - $this->sess_expiration;
 
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index d2774ca..50dab92 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -136,7 +136,7 @@
    -  Added unbuffered_row() method for getting a row without prefetching whole result (consume less memory).
 
 -  Libraries
-
+   -  CI_Session now respects php.ini's session.gc_probability and session.gc_divisor
    -  Added max_filename_increment config setting for Upload library.
    -  CI_Loader::_ci_autoloader() is now a protected method.
    -  Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname).