<human>: Could you distill the essence of the text into 1-3 sentences?

My dog is a 2.5 year old Pit/Boxer. She will have "accidents" inside and will ALWAYS get into the garbage if we don't put it on the counter (she has even ripped a cabinet door off to get to it). She is left alone 90% of the time for a max of 4 hours. I have been told and have read many times that dogs don't understand a punishment if you were gone when the incident occurred. But when my girlfriend or I get home she will run and hide in her kennel when she has been bad but if she hasn't done anything she will be at the door waiting all happy and waggy. It really seems as if she knows when she has been bad. So how can I stop this behavior?
<bot>: My dog (2.5 year old Pit/Boxer) is bad when we are gone (accidents/garbage) and she always knows when she has been bad. How I can I get her to stop?