{if $column.orderBy && preg_match("/ DESC$/", $item->orderBy)} {math equation = "lastItemNumber - iteration" lastItemNumber = $item->paginator.lastItemNumber|default:1 iteration = $smarty.foreach.row.index} {else} {math equation = "firstItemNumber + iteration" firstItemNumber = $item->paginator.firstItemNumber|default:1 iteration = $smarty.foreach.row.index} {/if}