What is the connection between reputation and integrity? Well, it is sort of matter of inside vs. outside.
Reputation is what the people around you expect you to be, and they will either see it as positive or negative depending on whether they agree with your viewpoints or not.
Integrity on the other hand is all about what you think about yourself. It is about doing the right thing regardless of who is watching. That does not mean you need to always be a saint, but karma is kind of like you judging yourself: if you constantly do things you feel you shouldn't, then you will start to think worse about yourself, and as a result you will end up in a life where karma is a bitch.
On the other hand, if you constantly work towards bettering yourself, regardless of the situation around you, karma takes on a totally different nature...