if (pageCount > 0)
{
pages.Add(new ListItem("First", "1", currentPage > 1));
for (int i = 1; i <= pageCount; i++)
{
pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
}
pages.Add(new ListItem("Last", recordCount.ToString(), currentPage < pageCount));
}
<ul class="pages-pagina">
<li class="pages previous"><a href="#">Previous</a></li>
<li class="pages selected"><a href="#">1</a></li>
<li class="pages"><a href="#">2</a></li>
<li class="pages"><a href="#">3</a></li>
<li class="pages"><a href="#">4</a></li>
<li class="pages"><a href="#">5</a></li>
<li>...</li>
<li class="pages last"><a href="#">10</a></li>
<li class="pages next"><a href="#">Next</a></li>
</ul>
ListItem li = new ListItem(i.ToString(), i.ToString(), i != currentPage);
li.Attributes.Add("class", "pages");