CodeIgniter pagination when 2 variables in the URL

When 2 variables or number are present in the URL It occurs a problem in pagination. Easily solve this by the set the following config.

Example - http://test.com/CONTROLLER/FUNCTION/5/1

here 1 is the uri segment.

// set this is the function
$config['uri_segment'] = 4;