/**
* Creates a unique URL for a page language by adding a 'dash number'
* at the end of the provided user URL
* @param string $page The current page
* @param string $url The URL to make unique
* @param type $lang The language to make unique for (you can have the same URL for same page in diffrent languages)
* @return string The new URL
*/
function uniquePageUrl($page, $url, $lang){
while(TRUE){
$result = $this->db->from('pages')->where('page <>', $page)->where('lang',$lang)->where('url',$url)->limit(1)->get()->row();
if($result) //we already have a page URL for this language like the one we try to use
$url = increment_string($url,'-');
else
return $url;
}
}