Terrell E. Porter of Alton was sentenced to five years for an unprovoked attack on a Hayner Public Library librarian.