<?php 
mb_internal_encoding("UTF-8");
if(isset($_GET['tpage'])) {
   $tpage=$_GET['tpage'];
   } else {
       $tpage=0; // tpage is for url number like tpage=1,tpage=2
   }
   $trowsPerPage=10; // This is how many user showing in one page
   $toffset=($tpage-1)* $trowsPerPage;  //Balancing the number of user shown
   $updatesarray=$Mat->Follower_List($profile_uid, $tpage, $toffset, $trowsPerPage) ;
   if($updatesarray) {
	  $last_letter = "";
      foreach($updatesarray as $data) {
         $list_username=$data['username'];
         $friend_uid=$data['uid'];
		 $check_verif=$data['verified'];
		 // user profile image for follower list
         $userface=$Mat->User_Lister($friend_uid,$base_url);
		 // user full name for follower list
         $userfullname = $Mat->UserFullName($list_username);
         $letter = mb_strtoupper(mb_substr($userfullname,0,1 , "UTF-8"), "UTF-8");
         if($letter != $last_letter) {
		    // alphabetically the knee
            echo '<div class="list-alphabet">'.$letter.'</div>'; 
            $last_letter = $letter;
          }
?>
<div class="follower md-ripple">
   <div class="follower-img">
     <a href="<?php echo $list_username;?>"><img src="<?php echo $userface;?>" border="0"></a>
    </div> 
    <a href="<?php echo $base_url.$list_username;?>">
    <div class="follower-name">
	<?php echo htmlspecialchars($userfullname); ?><?php if($check_verif == 1){ echo '<img src="'.$base_url.'mat_icons/verified.png" width="23px" height="23px">';}?>
    </div>
    </a>
   <?php   
   $profile_uid=$friend_uid; 
   include('follow_unfollow_follower_list.php'); 
   ?>
</div>
<?php
}
} else {
    echo '<div class="no-added-friend">No person will be shown!</div>';
}
//Next Previous Buttons
if($user_ufollower_count > $trowsPerPage) {
	// If the user follower count greater then trowsperpage then show the next and previous button
   $tmaxPage = ceil($user_ufollower_count/$trowsPerPage);  // Calculate the max page
   $self = $_SERVER['PHP_SELF'];
   $nav = '';
   $prev='';
   $next='';
   if($tpage > 1) { // If URl number is bigger then 1
      $tpagee = $tpage - 1;
      $tpath=$base_url.'followers/'.$username.'/'.$tpagee; // button URL
      $prev = "<span id=\"prev\" class='nbutton color'> <a href='$tpath' class='next'><< Prev</a></span> ";
    }
    if($tpage < $tmaxPage) {
		// If the maximum page number bigger then tpage then show the next button
       if($tpage) {
           $tpagee= $tpage + 1;	
         } else {
              $tpagee= $tpage + 2;	
         }
             $tpath=$base_url.'followers/'.$username.'/'.$tpagee; // Button URL
             $next = "<span id=\"next\" class='nbutton color'> <a href='$tpath' class='next'>Next >></a></span> ";	
     } 
?>
<div style="
  float:left;
  width: 100%;
  text-align: center;
  background-color:#ffffff;
  padding-bottom:10px;
  padding-top:10px;
  color:#009688;
  font-weight: 400;
  font-size: 16px;
  font-family: Helvatica,Arial, 'lucida grande',tahoma,verdana,arial,sans-serif;
  -webkit-border-bottom-right-radius: 3px;
  -webkit-border-bottom-left-radius: 3px;
  -moz-border-radius-bottomright: 3px;
  -moz-border-radius-bottomleft: 3px;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;">
<?php echo $prev; ?>
<?php echo $next; ?>
</div>
<?php 
} 
?>
