fix to pagination when first and last element has class ls-active

close issue #1141