move var perPage to the inside of portfolio function