Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into develop
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 008c151..63b750b 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -128,7 +128,7 @@
 		}
 
 		// Calculate the total number of pages
-		$num_pages = ceil($this->total_rows / $this->per_page);
+		$num_pages = (int) ceil($this->total_rows / $this->per_page);
 
 		// Is there only one page? Hm... nothing more to do here then.
 		if ($num_pages === 1)
diff --git a/system/libraries/Typography.php b/system/libraries/Typography.php
index 651ba7b..ac9486a 100644
--- a/system/libraries/Typography.php
+++ b/system/libraries/Typography.php
@@ -144,7 +144,7 @@
 		$process = TRUE;
 		$paragraph = FALSE;
 
-		for ($i = 1, $c = count($chunks); $i <= $c; $i++)
+		for ($i = 0, $c = count($chunks) - 1; $i <= $c; $i++)
 		{
 			// Are we dealing with a tag? If so, we'll skip the processing for this cycle.
 			// Well also set the "process" flag which allows us to skip <pre> tags and a few other things.